# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=py3-installer
pkgver=0.7.0
pkgrel=2
pkgdesc="low-level library for installing from a Python wheel distribution"
url="https://github.com/pypa/installer"
arch="noarch"
license="MIT"
depends="python3"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/py3/i/installer/installer-$pkgver-py3-none-any.whl
	default-bytecode-levels.patch
	"
# checkdepends causes weird circular behaviour,
# because py3-pytest depends on this down the chain
options="!check"

unpack() {
	default_unpack

	# we have to use the wheel because py3-installer is the base to be able to
	# install generated wheels, so we don't have it when building it itself
	mkdir -p "$builddir"
	unzip -d "$builddir" "$srcdir"/installer-$pkgver-py3-none-any.whl
}

package() {
	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
	mkdir -p "$pkgdir/$sitedir"
	cp -a installer* "$pkgdir/$sitedir"

	python3 -m compileall "$pkgdir/$sitedir"
}

sha512sums="
8e10013521238ef8fb2f5ab4bd00f6154c05046011cad8824d96b7cdc4ed235b87e534d1e163a47a11dbfb5bb3cf19d9a2ea3edd1e9c9ce5fbc9a375010c36dc  installer-0.7.0-py3-none-any.whl
d389b34e2de943823978b1a8a782a6e14a50b577870e71a95a4482ffbbf3a79217e0aa00673166f5e75d6ce9c07ee4d029d7baa8b37c0914a2429e2e04df4dd4  default-bytecode-levels.patch
"
